#define _CRT_SECURE_NO_WARNINGS 1
#include<string>
#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int compareVersion(string version1, string version2) {
        int n1 = version1.size(), n2 = version2.size();
        int l1 = 0, l2 = 0;
        while (l1 < n1 || l2 < n2)
        {
            int num1 = 0;
            while (l1 < n1 && version1[l1] != '.')
            {
                num1 = num1 * 10 + (version1[l1] - '0');
                l1++;
            }
            l1++;
            int num2 = 0;
            while (l2 < n2 && version2[l2] != '.')
            {
                num2 = num2 * 10 + (version2[l2] - '0');
                l2++;
            }
            l2++;
            if (num1 < num2) return -1;
            else if (num1 > num2) return 1;
        }
        return 0;
    }
};